import java.sql.ResultSet;

import controlP5.ControlEvent;
import controlP5.Controller;
import controlP5.ScrollList;


public class PopulateList extends ControlEvent{

	protected PopulateList(ScrollList slist) {
		super(slist);
		
		CSVConn myconn = new CSVConn("/Users/andy/Documents/workspace/Fresh/data");		
		
		if(myconn.query("SELECT * FROM partial_genes4329") == 1) {
			ResultSet results = myconn.getResults();	
			try
			{
				// dump out the results
				int id = 0;
				while (results.next())
				{
					String gene = results.getString("Gene");
					slist.addItem(gene, id).setId(id);
					id++;
				}
			}
			catch(Exception e)
			{
				System.out.println("Error in Main-> " + e);
			}
		}
	}

}
